<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Insert title here</title>
<link href="/resource/css/bootstrap.css" rel="stylesheet">
<script type="text/javascript" src="/resource/js/jquery-3.2.1.js"></script>
<script type="text/javascript" src="/resource/js/bootstrap.min.js"></script>

<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>

	<h1>品牌入住</h1>
	
	<form id="fm">
	<div>
	<label for="formGroupExampleInput">品牌入驻</label> <input type="text"
				class="form-control" id="formGroupExampleInput"
				placeholder="请输入品牌名称" name="name">
	
	</div>
	<div class="form-group">
			<label for="exampleFormControlFile1"></label> <input type="file"
				name="file" "form-control-file" id="exampleFormControlFile1">
	</div>
	
	</form>
	<button type="button" class="btn btn-primary" onclick="add()"/>添加</button>
	<script type="text/javascript">
	function add(){
		
		var formData = new FormData($("#fm")[0]);
		$.ajax({
			url:"/brand/add",
			type:"post",
			data:formData,
			processData:false,
			contentType:false,
			success:function(flag){
				if(flag){
					alert("添加成功");
					$("#workArea").load("/brand/list");
				}else{
					alert("添加失败");
				}
			}
		
		})
	}
	
	</script>
</body>

</html>